<!DOCTYPE html>
<html class="ui-page-login">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title>注册</title>
	<meta name="Keywords" content=""/>
	<meta name="description" content="" />
	<script src="__ROOT__/static/home/css/userInfo/js/mui.min.js"></script>
	<link href="__ROOT__/static/home/css/userInfo/css/mui.min.css" rel="stylesheet"/>
	<link rel="stylesheet" href="__ROOT__/static/home/css/userInfo/css/style.css" />
	<script src="__ROOT__/static/plugins/layer.mobile-v2.0/layer_mobile/need/layer.css"></script>
	<link href="__ROOT__/static/home/css/login.css" rel="stylesheet"/>
	<script src="__ROOT__/static/home/js/jquery-1.11.1.min.js"></script>
	<script src="__ROOT__/static/plugins/layer.mobile-v2.0/layer_mobile/layer.js"></script>
</head>
<body style="background-color:#EFEFF4">
<script>
    $(document).ready(function(){
        $("#reg").click(function(){
            var reg ={};
			reg.userName = $.trim($("#username").val());
            reg.pwd = $.trim($("#password").val());
            reg.pwds = $.trim($("#passwords").val());
            reg.nickName = $.trim($("#nickname").val());
            reg.phone=$.trim($("#phone").val());
            reg.email=$.trim($("#email").val());
            $.ajax({
                cache:true,
                type:"POST",
                url:"{:url('home/Login/regLogin')}",
                dataTypes:"text",
                data:reg,
                async:false,
                success:function(data){
                   if(data==1){
                       layer.open({
                           content: '注册成功是否绑定手机号码'
                           ,btn: ['是，我要去绑定', '不，我要到首页']
                           ,yes: function(index){
                               layer.close(window.location.href='{:url(\'home/Login/binding\')}');
                           }
                           ,no:function (index) {
                               layer.close(window.location.href='{:url('home/Index/index')}');
                           }
                       });
				   }else if(data==2){
                       layer.open({
                           content: '你有信息未完成填写',
                           skin: 'msg',
                           time: 2 //2秒后自动关闭
                       });
				   }else if(data==3){
                       layer.open({
                           content: '密码长度不符合要求',
                           skin: 'msg',
                           time: 2 //2秒后自动关闭
                       });
                   }else if(data==4){
                       layer.open({
                           content: '两次输入的密码不一样',
                           skin: 'msg',
                           time: 2 //2秒后自动关闭
                       });
                   }else if(data==6){
                       layer.open({
                           content: '账号已存在',
                           skin: 'msg',
                           time: 2 //2秒后自动关闭
                       });
                   }
				}
			})
	})
	})
</script>
<header class="mui-bar mui-bar-nav">
	<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	<h1 class="mui-title">注册</h1>
</header>
<div class="mui-content">
	<div class="mui-input-group">
		<div class="mui-input-row">
			<label>账号</label>
			<input id='username' type="text" class="mui-input-clear mui-input"  name="user_name" placeholder="请输入你喜欢的账号">
		</div>
		<div class="mui-input-row">
			<label>密码</label>
			<input id='password' type="password" class="mui-input-clear mui-input" name="password" placeholder="请输入6到16位的密码">
		</div>
		<div class="mui-input-row">
			<label>确认</label>
			<input id='passwords' type="password" class="mui-input-clear mui-input" name="password_confirm" placeholder="请再次确认密码">
		</div>
		<div class="mui-input-row">
			<label>昵称</label>
			<input id='nickname' type="text" class="mui-input-clear mui-input" name="password_confirm" placeholder="请输入昵称">
		</div>
	</div>
	<div class="mui-content-padded">
		<button id='reg'  class="mui-btn mui-btn-block mui-btn-primary">注册</button>
	</div>
	<div class="mui-content-padded">
		<p>注册真实可用，注册成功后的用户可用于登录，注册后请绑定手机号码，手机号码可用于找回密码</p>
	</div>
</div>
<script>
//	获取数据
    $(document).ready(function(){
        $("#username").mouseout(function(){
            var username=$.trim($("#username").val());
			if(!username){
                layer.open({
                    content: '用户账号不能为空'
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
			}
        })
		$("#password").mouseout(function(){
            var password=$.trim($("#password").val());
            if(!password){
                layer.open({
                    content: '你忘记输入密码了'
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
			}
        })
        $("#passwords").mouseout(function(){
            var password=$.trim($("#password").val());
            var passwords=$.trim($("#passwords").val());
            if(!password){
                layer.open({
                    content: '请填写密码'
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
            }else if(password!==passwords){
                layer.open({
                    content: '两次输入的密码不一样哦'
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
			}
        })
        $("#nickname").mouseout(function(){
            var nickname=$.trim($("#nickname").val());
            if(!nickname){
                layer.open({
                    content: '昵称不能为空'
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
            }
        })
    })

</script>
</body>
</html>